<template>
	<nt-container>
		<view class="nt-transfer">
			<u--textarea v-model="remarks" placeholder="请输入备注信息或原因" height="150"></u--textarea>
			<view class="nt-transfer-button">
				<nt-button text="提交申请转单['转回客服']" @click="submit"></nt-button>
			</view>
		</view>
	</nt-container>
</template>

<script>
	import {
		applyTransferOrder
	} from "@/api"
	export default {
		data() {
			return {
				remarks: '',
				id: ""
			}
		},
		onLoad(options) {
			this.id = options.id
		},
		methods: {
			// 提交转单申请
			submit() {
				if (!this.remarks) return this.toast("请输入备注信息或原因")
				applyTransferOrder(this.id, this.remarks).then(res => {
					const {
						code
					} = res;
					if (code === 1) {
						this.toast("申请转单已提交")
						setTimeout(() => {
							this.back()
							uni.$emit("changeList")
						}, 1000)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.nt-transfer {
		padding: 30rpx;
		box-sizing: border-box;

		&-button {
			border-radius: 100rpx;
			overflow: hidden;
			margin-top: 50rpx
		}
	}
</style>